/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.clicarros.dao.Implementacao.navegacao;

import br.com.clicarros.dao.Implementacao.AbstractDAO;
import br.com.clicarros.dominio.navegacao.Navegacao;
import br.com.clicarros.util.UtilHibernate;
import java.sql.SQLException;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;

/**
 *
 * @author Bruno
 */
public class DAONavegacao extends AbstractDAO {

    @Override
    public List<Object> consultar(Object o) throws ClassNotFoundException, SQLException, Exception {
        Navegacao navegacao = (Navegacao) o;
        List retorno;
        Session session = UtilHibernate.openSession();
        
        Criteria c = session.createCriteria(Navegacao.class);
        c.add(Restrictions.eq("usuario.idUsuario", navegacao.getUsuario().getIdUsuario()));
        
        retorno = c.list();
        
        
        session.close();
        
        return retorno;
        
    }
    
}
